Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

de-mystify resource internals #1166

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Owner

No description provided.

Copy link

stackblitz bot commented Dec 25, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Dec 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ember-resources-0a9q ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 26, 2025 5:04pm

Copy link
Contributor

github-actions bot commented Dec 25, 2024

Estimated impact to a consuming app, depending on which bundle is imported

js min min + gzip min + brotli
/index.js 14.32 kB 4.28 kB 1.72 kB 1.47 kB

is thish better? maybe tests will tell me

ope

ope

The builder had to be registered to the helper manager

Be more robust with owner detection

Maybe progress

it works, now for memory leak testing
test('a generated interval can be cleared', async function (assert) {
const id = cell(0);
const condition = cell(true);

const poll = resourceFactory((id: number) => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resourceFactory isn't needed here, and is kinda awkward to have inline like this (moreso that the call below, imo)

@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review February 16, 2025 19:13
@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Feb 28, 2025
@NullVoxPopuli
Copy link
Owner Author

Review from devin.ai:

PR Review: ember-resources #1166 "de-mystify resource internals"

Summary

This PR successfully transforms the internal resource mechanics into a more explicit, transparent public API through a new Builder/Resource pattern. The changes maintain backward compatibility while making the implementation more accessible to developers.

Key Changes

  1. New Builder/Resource Pattern: Introduces explicit classes that expose previously internal mechanics
  2. Simplified Resource Manager: Delegates functionality to the new Resource class
  3. Improved Documentation: Adds helpful comments explaining implementation choices
  4. Maintained Compatibility: Preserves existing API while exposing internals

Code Quality Assessment

  • Type Definitions: Properly defined with generics for type safety
  • Code Formatting: Maintains consistent style with existing codebase
  • Comments: Explains why implementation choices were made, not just what the code does
  • Tests: Comprehensive test coverage for the new API

Recommendation

Approve and Merge the PR. The changes successfully "de-mystify" resource internals by making them more explicit and transparent, which will benefit developers working with the library. All CI checks are passing, and the code quality is high.

The PR achieves its stated goal of making the resource API less magical and more developer-friendly while maintaining backward compatibility.

@NullVoxPopuli
Copy link
Owner Author

Are there any issues with the PR?

Devin 1:18 PM

The PR has a few minor type definition issues (marked with @ts-expect-error in tests) and a TODO comment in Resource class that could be completed, but no significant issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant